Port constraint editor to gtk_widget_clear_template()
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 6 Jul 2022 12:22:54 +0000 (13:22 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 11 Jul 2022 17:24:37 +0000 (18:24 +0100)
demos/constraint-editor/constraint-editor-window.c
demos/constraint-editor/constraint-editor.c
demos/constraint-editor/guide-editor.c

index ca18e27cf8e9e771710eb8604fc05d9b617ecc16..80dc10c1c381fc51cda4d99bd92a9f9c9b0ca3b1 100644 (file)
@@ -361,11 +361,11 @@ save_cb (GtkWidget              *button,
 }
 
 static void
-constraint_editor_window_finalize (GObject *object)
+constraint_editor_window_dispose (GObject *object)
 {
-  //ConstraintEditorWindow *self = (ConstraintEditorWindow *)object;
+  gtk_widget_clear_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_WINDOW_TYPE);
 
-  G_OBJECT_CLASS (constraint_editor_window_parent_class)->finalize (object);
+  G_OBJECT_CLASS (constraint_editor_window_parent_class)->dispose (object);
 }
 
 static int child_counter;
@@ -497,7 +497,7 @@ constraint_editor_window_class_init (ConstraintEditorWindowClass *class)
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
 
-  object_class->finalize = constraint_editor_window_finalize;
+  object_class->dispose = constraint_editor_window_dispose;
 
   gtk_widget_class_set_template_from_resource (widget_class,
                                                "/org/gtk/gtk4/constraint-editor/constraint-editor-window.ui");
index 6f897b2d8a031ee0a7e6fc851fd2662bb5a9f0b3..17407bb439781aab7b728c0fd59278efe50acb2d 100644 (file)
@@ -607,10 +607,11 @@ constraint_editor_dispose (GObject *object)
 {
   ConstraintEditor *self = (ConstraintEditor *)object;
 
-  g_clear_pointer (&self->grid, gtk_widget_unparent);
   g_clear_object (&self->model);
   g_clear_object (&self->constraint);
 
+  gtk_widget_clear_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_TYPE);
+
   G_OBJECT_CLASS (constraint_editor_parent_class)->dispose (object);
 }
 
index 74dfe22f09614ff26aed92244421790b47082287..f7bc03937845feb4aaf09a20ef9b14c88fef449a 100644 (file)
@@ -294,9 +294,10 @@ guide_editor_dispose (GObject *object)
 {
   GuideEditor *self = (GuideEditor *)object;
 
-  g_clear_pointer (&self->grid, gtk_widget_unparent);
   g_clear_object (&self->guide);
 
+  gtk_widget_clear_template (GTK_WIDGET (self), GUIDE_EDITOR_TYPE);
+
   G_OBJECT_CLASS (guide_editor_parent_class)->dispose (object);
 }